feat: macOS universal binary instead of separate x64/arm64 builds#1050
feat: macOS universal binary instead of separate x64/arm64 builds#1050ewrogers wants to merge 1 commit intopingdotgg:mainfrom
Conversation
Replace the two separate macOS build matrix entries with a single universal binary build, producing a fat binary containing both x86_64 and arm64 slices in one .dmg. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip CodeRabbit can enforce grammar and style rules using `languagetool`.Configure the |
|
I'm not sure if I agree this is better user-experience. Especially on Macs where storage is so costly, I can't see the benefit in using the space in my system for code that doesn't run on my platform. The better user experience in this case is to automatically identify the platform on the public website, and link to the proper DMG for each user. |
|
Fair point, it's just a different angle of user-experience. The extra (doubled) disk space is a negative, but not needing to worry about which architecture you have is a plus. Granted this is developer focused so perhaps a non-issue on the latter. Electron apps aren't lightweight so I suppose 250MB versus 130MB is not ideal. Then again x86 for macOS is on the tail end with each generation of the M-series chips. |
|
This is quite interesting. I was the one who originally submitted the "merge manifests" part, as Intel users (at that time) were unable to update their app versions. I don't recall what code drives the creation of the "latest-mac-x64.yml" artifact, but I would first ensure that that artifact is no longer created upon release before I call this complete. Also, I would check if this breaks updates from those on the single-arch versions. I'm not entirely sure if |
Summary
macOS arm64onmacos-14+macOS x64onmacos-15-intel) with a single universal binary build (arch: universalonmacos-14)latest-mac.ymlrename workaround in the asset collection stepscripts/merge-mac-update-manifests.tsHow it works
No build script changes are needed — the existing
scripts/build-desktop-artifact.tsalready supportsuniversalas a valid arch value:BuildArchis defined asSchema.Literals(["arm64", "x64", "universal"])(line 21)["arm64", "x64", "universal"](lines 50-64)--universal(line 694), which electron-builder natively understands — it builds both x86_64 and arm64 slices, then uses@electron/universal(which wrapslipo) to merge them into a single fat binary automaticallyThis PR only changes the workflow YAML to pass
universalinstead of running two separate arch-specific jobs.Benefits
Simpler release pipeline
The workflow drops from 4 matrix jobs to 3. The macOS-specific manifest merging logic (
merge-mac-update-manifests.ts, thelatest-mac-x64.ymlrename) is eliminated entirely — fewer moving parts, fewer places for the release to break.Better user experience
Users download a single
.dmgthat works on both Intel and Apple Silicon Macs. No more choosing the wrong architecture, no confusion between two macOS downloads on the releases page.Simpler auto-update
With one universal build, electron-builder produces a single
latest-mac.ymlmanifest that covers both architectures. No need to merge two separate manifests at release time.Reduced CI cost
One macOS runner instead of two per release. Apple Silicon runners (
macos-14) can natively build universal binaries vialipo, so no cross-compilation is needed.Trade-offs
.dmgwill be roughly 2x the size of a single-arch DMG since it bundles both x86_64 and arm64 slices. This is standard practice (e.g. VS Code, Chrome, Discord all ship universal binaries).Test plan
.dmgis produced.dmgruns natively on both Apple Silicon and Intel Macslatest-mac.ymlis published without needing the merge script🤖 Generated with Claude Code